package com.manager.devicemanager.controller;

import com.manager.devicemanager.common.Result;
import com.manager.devicemanager.service.SystemSpaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.Map;

@RestController
@RequestMapping("/systemSpace")
public class SystemSpaceController {
    @Autowired
    private SystemSpaceService systemSpaceService;
    /**
     * 获取系统所有存储分区的总空间信息
     * @return 包含存储分区路径和对应总空间信息的 Map
     * @throws IOException 当获取存储信息出错时抛出异常
     */
    @GetMapping("/space")
    public Result<Map<String, Object>> getSystemStorageInfo() throws IOException {
        return Result.success(systemSpaceService.getSystemStorageInfo());

    }

}
